﻿#region

using System.Collections.Generic;
using System.IO;
using System.Linq;
using Minion.Win.Client.Models;
using Newtonsoft.Json;

#endregion

namespace Minion.Win.Client.Service.Concrete
{
    public class DemoDataService : IDataService
    {
        public List<Location> GetLocationItems(double lat, double lon)
        {
            //var dataContext = new List<LocationItemListViewModel>();
            List<Location> locationsData;
            using (StreamReader file = File.OpenText(@"Demo/DemoData.txt"))
            {
                var serializer = new JsonSerializer();
                locationsData = (List<Location>) serializer.Deserialize(file, typeof (List<Location>));
            }
            //filter the locations data
            var filteredLocationsData = locationsData.Where(l => l.Latitude == lat && l.Longitude == lon).ToList();
            //dataContext = Converter.ConvertToLocationItemListViewModel(filteredLocationsData).ToList();
            return filteredLocationsData;
        }

        public void SaveLocationItem(Location location)
        {
            throw new System.NotImplementedException();
        }
    }
}